// 主界面
;
define(function(require, exports, module) {
	'use strict';
	var base = require("base");
	var databind = require("databind");
	var tools = require("tools");
	var constant = require("constant");
	var recordType = [];
	var recordId = [];

	var init = function() {
		recordType = base.getUrlParam("recordType").split(',');
		recordId = base.getUrlParam("recordId").split(',');
		document.title = constant.getValueByKey(69, recordType[recordType.length*1 - 1]);
		inquirePickUpGoodsAuditRecord();
		initEvent();
	};
	var initEvent = function() {
//		var str = "";
//		$.each(recordType, function(index, value) {
//			tools.inquirePickUpGoodsAuditRecord(recordType[index], recordId[index], function(data){
//				if (data.datas.length <= 0) {
//					layer.msg("暂无审批记录");
//					setTimeout(function(){
//						window.close();
//					}, 2500);
//				}
//				var l = data.datas;
//				$.each(data.datas, function() {
//					var _this = this;
//					var d = _this.auditDate.substring(0, 10);
//					var t = _this.auditDate.substring(10, 16);
//					var str = '<li><time class="cbp_tmtime" datetime=""><span>' + d + '</span> <span>' + t + '</span></time><div class="cbp_tmicon cbp_tmicon-screen"></div><div class="cbp_tmlabel"><h2>' + _this.roleName + _this.accountName  + constant.getValueByKey(70, _this.auditState) + '</h2><p>' + _this.opinion + '</p></div></li>'
//					$(".cbp_tmtimeline").append(str);
//				});
//			});
//		});

	};
	var str = ""; 
	
	 var inquirePickUpGoodsAuditRecord =function(){
			base.fnAjax({
				action : "inquirePickUpGoodsAuditRecord.json",
				async : false, // 同步异步
				oData : {
					recordType : recordType,
					recordId : recordId
				}, // 传递参数
				fnSuccess : function(data) {
					if (data.datas.length <= 0) {
						layer.msg("暂无审批记录");
						setTimeout(function(){
							window.close();
						}, 2500);
					}
					var l = data.datas;
					$.each(data.datas, function() {
						var _this = this;
						var d = _this.auditDate.substring(0, 10);
						var t = _this.auditDate.substring(10, 16);
						var str = '<li><time class="cbp_tmtime" datetime=""><span>' + d + '</span> <span>' + t + '</span></time><div class="cbp_tmicon cbp_tmicon-screen"></div><div class="cbp_tmlabel"><h2>' + _this.roleName + _this.accountName  + constant.getValueByKey(70, _this.auditState) + '</h2><p>' + _this.opinion + '</p></div></li>'
						$(".cbp_tmtimeline").append(str);
					});
				}
			});
		};

	return {
		init: init
	};
});